1import { Label, Navigation, Script, TabView, Text, useState } from "scripting"
2
3function Example() {
4 const [tabIndex, setTabIndex] = useState(0)
5
6 return <TabView
7 tabIndex={tabIndex}
8 onTabIndexChanged={setTabIndex}
9 >
10 <ReceivedView
11 tag={0}
12 tabItem={
13 <Label
14 title={"Received"}
15 systemImage={"tray.and.arrow.down.fill"}
16 />
17 }
18 badge={2}
19 />
20 <SendView
21 tag={1}
22 tabItem={
23 <Label
24 title={"Send"}
25 systemImage={"tray.and.arrow.up.fill"}
26 />
27 }
28 />
29 <AccountView
30 tag={2}
31 badge={"!"}
32 tabItem={
33 <Label
34 title={"Account"}
35 systemImage={"person.crop.circle.fill"}
36 />
37 }
38 />
39 </TabView>
40}
41
42function ReceivedView() {
43 return <Text>Received view</Text>
44}
45
46function SendView() {
47 return <Text>Send view</Text>
48}
49
50function AccountView() {
51 return <Text>Account view</Text>
52}
53
54async function run() {
55 await Navigation.present({
56 element: <Example />
57 })
58
59 Script.exit()
60}
61
62run()